#!/bin/sh -e

mkdir bin

(
  echo sha256
) | (
  while read n
  do
    okabi | (
      while read abi
      do
        okc-$abi | (
          while read c
          do
            echo "=== `date` === Trying $n.c with $c..." >&2
            rm -f adequatechecksum.c
	    cp $n.c adequatechecksum.c || continue
            $c -o adequatechecksum adequatechecksum.c || continue
	    case `echo hello | ./adequatechecksum || :` in
	      5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03)
	        ;;
              *)
	        continue
		;;
            esac
	    cp adequatechecksum bin/adequatechecksum
            exit 0
          done
          exit 111
        ) && exit 0
      done
      exit 111
    ) && exit 0
  done
  exit 111
)
